import json

from infrastructure_process.models import InfrastructureMaintenance, ProfessionalServices
from medical_ethics.models import EvaluationOfMedicalEthics
from django.db.models import Q
from administrative.models import Topics, ConferenceMemo, OfficialDocuments, VehicleApply, Correspondence, Company, \
    PaymentApproval, ContractApproval
from announcements.models import Notice
from finance.models import TravelApply, MedicalMaterials, MaintainServer, GeneralFinance, NutritionalMealsAuditRecord, \
    NutritionalMeals, NewMedicalServices, SurgicalGrading, LeaveRequest, LogisticsOffice, SoloPracticeApply, \
    BusinessContract, TravelReimbursement, Dimission, PayWithBlood, OutgoingCadresData, LaborUnionExpenses, SealMaking, \
    SubjectFunding, QuickAuthorization, BookSubscription, PartyBuilding, ObjectAudit, ResearchFunding, \
    ConfidentialDataExport
from logistics.models import PurchasingRequisition, GoodsProcure, MaintenanceRenovation, ComputerDevice, \
    BiddingProcurementProject, TenderingSigning
from payment_management.models import SupportSubsidies
from personal_center.models import ConferenceRoomApplication, ProductAdopt, ProductPurchase, SealApply, FixedAssets, \
    User
from personal_center.sql_file import manage_flow
from supervision_inspection.models import ShortMessageApproval, FlowModify, InitiateAccountability, CommitteeTopics, \
    CommitteeMinutes, ShiftAdjustment, MeetingRoomLeave
from system_setup.models import LowCodeBill
from NewFlowLogic.models import *
from union_process.models import OfficialSeal, EconomicCountersign, PaymentProcess, EventApproval, MaterialsApproval, \
    OutpatientScheduling


class SearchData():
    def search_daiban(self, datavalue, search_val, request, page1, page2):
        user = request.user
        flag = False
        return_data = manage_flow().my_audit(request.user.id, request.user.real_name)
        if not datavalue:
            datavalue = return_data[0][1]
            flag = True
        if datavalue == "院长办公会议题":
            all_count = Topics.objects.filter(~Q(state="shelve"),
                                              Q(topics_name__contains=search_val) | Q(
                                                  employee__real_name__contains=search_val) | Q(
                                                  employee__department__contains=search_val),
                                              current_audit_user=request.user.real_name,
                                              type='yb').order_by("-create_time").count()
            all_data = Topics.objects.filter(~Q(state="shelve"),
                                             Q(topics_name__contains=search_val) | Q(
                                                 employee__real_name__contains=search_val) | Q(
                                                 employee__department__contains=search_val),
                                             current_audit_user=request.user.real_name,
                                             type='yb').order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.topics_name, "create_by": i.employee.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": i.current_audit_user,
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                 "url": f'/personal-center/SubjectDetailst.html?id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                 'text': f"""<a href="/personal-center/SubjectDetailst.html?id={i.id}">审批</a> | <a href="javaacript:;" onclick="line_modes('4', {i.id})">搁置</a>""" if i.state != "refuse" else "修改",
                 "types": "院长办公会议题"} for i in all_data]
        elif datavalue == "行政例会议题":
            all_count = Topics.objects.filter(~Q(state="shelve"),
                                              Q(topics_name__contains=search_val) | Q(
                                                  employee__real_name__contains=search_val) | Q(
                                                  employee__department__contains=search_val),
                                              current_audit_user=request.user.real_name,
                                              type='xz').order_by("-create_time").count()
            all_data = Topics.objects.filter(~Q(state="shelve"),
                                             Q(topics_name__contains=search_val) | Q(
                                                 employee__real_name__contains=search_val) | Q(
                                                 employee__department__contains=search_val),
                                             current_audit_user=request.user.real_name,
                                             type='xz').order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.topics_name, "create_by": i.employee.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": i.current_audit_user,
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                 "url": f'/personal-center/SubjectDetailst.html?id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                 'text': f"""<a href="/personal-center/SubjectDetailst.html?id={i.id}">审批</a> | <a href="javaacript:;" onclick="line_modes('4', {i.id})">搁置</a>""" if i.state != "refuse" else "修改",
                 "types": "行政例会议题"} for i in all_data]
        elif datavalue == "党委会议题":
            all_count = Topics.objects.filter(~Q(state="shelve"),
                                              Q(topics_name__contains=search_val) | Q(
                                                  employee__real_name__contains=search_val) | Q(
                                                  employee__department__contains=search_val),
                                              current_audit_user=request.user.real_name,
                                              type='db').order_by("-create_time").count()
            all_data = Topics.objects.filter(~Q(state="shelve"),
                                             Q(topics_name__contains=search_val) | Q(
                                                 employee__real_name__contains=search_val) | Q(
                                                 employee__department__contains=search_val),
                                             current_audit_user=request.user.real_name,
                                             type='db').order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.topics_name, "create_by": i.employee.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": i.current_audit_user,
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                 "url": f'/personal-center/SubjectDetailst.html?id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                 'text': f"""<a href="/personal-center/SubjectDetailst.html?id={i.id}">审批</a> | <a href="javaacript:;" onclick="line_modes('4', {i.id})">搁置</a>""" if i.state != "refuse" else "修改",
                 "types": "党委会议题"} for i in all_data]
        elif datavalue == "党委会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='a').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='a').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批", "types": "党委会议纪要"}
                         for i in all_data]
        elif datavalue == "院长办公会会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='b').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='b').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批",
                          "types": "院长办公会会议纪要"} for i in all_data]
        elif datavalue == "党委专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='c').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='c').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批",
                          "types": "党委专题会议纪要"} for i in all_data]
        elif datavalue == "院长办公会专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='d').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='d').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批",
                          "types": "院长办公会专题会议纪要"} for i in all_data]
        elif datavalue == "行政例会简报":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='e').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='e').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批", "types": "行政例会简报"}
                         for i in all_data]
        elif datavalue == "行政公文(京医发)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='f').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='f').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批", "types": "京医发"}
                         for i in all_data]
        elif datavalue == "党委公文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='g').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='g').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批", "types": "党委公文"}
                         for i in all_data]
        elif datavalue == "京医团总支发文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='i').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='i').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批",
                          "types": "京医团总支发文"} for i in all_data]
        elif datavalue == "行政公文(京医文)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='h').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='h').order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/refer_back.html?id={i.id}' if i.state == "six" else f'document_approve.html?id={i.id}',
                          'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "审批", "types": "京医文"}
                         for i in all_data]
        elif datavalue == "上级来文":
            all_count = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "待分发" if i.type == "g" else "退回" if i.type == "f" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/examinationDetail.html?approve=1&id={i.id}', "admin_add": "",
                 'text': "分发" if i.type == "g" else "修改" if i.type == "f" else "审批", "types": "上级来文"} for i in all_data]
        elif datavalue == "外部来函":
            all_count = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "待分发" if i.type == "g" else "退回" if i.type == "f" else "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/ExternalCorrespondenceDetail.html?approve=1&id={i.id}', "admin_add": "",
                 'text': "分发" if i.type == "g" else "修改" if i.type == "f" else "审批", "types": "外部来函"} for i in all_data]
        elif datavalue == "委员会议题":
            all_count = CommitteeTopics.objects.filter(
                Q(topic_name__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = CommitteeTopics.objects.filter(
                Q(topic_name__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[
                       page1:page2]
            data_list = [
                {"title": i.topic_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/supervision-inspection/committee_topics_detail.html?id={i.id}' if i.state != "refuse" else f'/supervision-inspection/committee_topics_modify.html?id={i.id}',
                 'text': f"""<a href="/supervision-inspection/committee_topics_detail.html?id={i.id}">审批</a>""" if i.state != "refuse" else "修改",
                 "types": "委员会议题"} for i in all_data]
        elif datavalue == "委员会纪要":
            all_count = CommitteeMinutes.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val),
                current_audit_users=request.user).order_by("-create_time").count()
            all_data = CommitteeMinutes.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val),
                current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/supervision-inspection/summary_application_detail.html?id={i.id}',
                 'text': "审批" if i.state != "refuse" else "修改", "types": "委员会纪要"} for i in all_data]
        elif datavalue == "通知公告":
            all_count = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.name, "create_by": i.create_people.real_name, "department": i.create_people.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "审核中" if i.state in ["one", "two"] else "退回", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/announcements/notice_approve.html?id={i.id}' if i.state in ["one",
                                                                                       "two"] else f'/announcements/notice_change.html?id={i.id}',
                 "admin_add": "",
                 'text': "审批" if i.state in ["one", "two"] else "修改", "types": "通知公告"} for i in all_data]
        elif datavalue == "会议室申请":
            all_count = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), audit_people_id=request.user).order_by("-create_time").count()
            all_data = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), audit_people_id=request.user).order_by("-create_time")[
                       page1:page2]
            data_list = [{"title": i.particulars, "create_by": i.names, "department": i.department,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "审核中",  "reviewer": i.audit_people.real_name if i.audit_people else "",
                          "approved": f'<a href="javascript:;" style="color: red;">{i.audit_people.real_name}</a>' if i.audit_people else "",
                          "url": f'/personal-center/conference_room_detail?id={i.id}', "admin_add": "",
                          'text': "审批", "types": "会议室申请"} for i in all_data]
        elif datavalue == "车辆申请":
            all_count = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_user=request.user).order_by(
                "-create_time").count()
            all_data = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.subject, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "审核中" if i.state != "refuse" else "退回", "reviewer": i.current_audit_user.real_name if i.current_audit_user else "",
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user.real_name}</a>' if i.current_audit_user else "",
                 "url": f'/personal-center/Vehicle_apply_detail.html?id={i.id}' if i.state != "refuse" else f'car_recommit.html?id={i.id}',
                 "admin_add": "",
                 'text': "审批" if i.state != "refuse" else "修改", "types": "车辆申请"} for i in all_data]
        elif datavalue == "大型活动报备":
            all_count = user.gathering_apply_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val)).count()
            all_data = user.gathering_apply_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val)).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.gathering_place, "create_by": i.apply_user.real_name, "department": i.apply_company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "审核中" if i.state != "three" else "退回", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/administrative/gathering_apply_detail_view?id={i.id}' if i.state != "refuse" else f'/administrative/gathering_apply_detail_view?id={i.id}',
                 "admin_add": "",
                 'text': "审批" if i.state != "three" else "修改", "types": "大型活动报备"} for i in all_data]
        elif datavalue == "医德医风考评":
            all_count = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name,
                 "department": "医德医风评选一组" if i.apply_company_id == "1001" else "医德医风评选二组" if i.apply_company_id == "1002" else "医德医风评选三组" if i.apply_company_id == "1003" else "医德医风评选四组" if i.apply_company_id == "1004" else Company.objects.get(
                     id=i.apply_company_id).name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "审核中", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/medical-ethics/medical_ethics_detail_view?id={i.id}',
                 "admin_add": "",
                 'text': "审批", "types": "医德医风考评"} for i in all_data]
        elif datavalue == "物资领用":
            all_count = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_display(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_adopt_detail_view?id={i.id}',
                 'text': "审批", "types": "物资领用"} for i in all_data]
        elif datavalue == "物资采购":
            all_count = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_display(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_shenpi_view?id={i.id}',
                 'text': "审批", "types": "物资采购"} for i in all_data]
        elif datavalue == "用印申请":
            all_count = SealApply.objects.filter(~Q(state='shelve'),
                                                 Q(apply_user__real_name__contains=search_val) | Q(
                                                     apply_user__department__contains=search_val),
                                                 current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = SealApply.objects.filter(~Q(state='shelve'),
                                                Q(apply_user__real_name__contains=search_val) | Q(
                                                    apply_user__department__contains=search_val),
                                                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.matter_type_text, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/seal_apply_detail_view?id={i.id}',
                 'text': f"""<a href="/personal-center/seal_apply_detail_view?id={i.id}">审批</a> | <a href="javaacript:;" onclick="line_modes('9', {i.id})">搁置</a>""",
                 "types": "快捷用印申请" if i.is_fast else "用印申请"} for i in all_data]
        elif datavalue == "印章刻制":
            all_count = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.plan_seal_name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/seal_making_detail_view?id={i.id}',
                 'text': "审批", "types": "印章刻制"} for i in all_data]
        elif datavalue == "快速用印授权":
            all_count = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[
                       page1:page2]
            data_list = [
                {"title": json.loads(i.reason)[0]['neirong'], "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/QuickAuthorizationDetail.html?id={i.id}',
                 'text': "审批", "types": "快速用印授权"} for i in all_data]
        elif datavalue == "固定资产/维修维保付款":
            all_count = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/personal-center/fixed_assets_apply_detail_view?id=" + str(i.id),
                 'text': "审批" if i.get_str_state() != '拒绝' else '修改', "types": "固定资产/维修维保付款"} for i in all_data]
        elif datavalue == "差旅申请":
            all_count = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.subject, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/travel_apply_detail_view?id=" + str(i.id),
                 'text': "修改" if i.get_state_str() == '拒绝' else '审批', "types": "差旅申请"} for i in all_data]
        elif datavalue == "中层干部外出":
            all_count = OutgoingCadresData.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = OutgoingCadresData.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/middle_level_detail.html?id=" + str(i.id),
                 'text': "修改" if i.get_state_str() == '拒绝' else '审批', "types": "中层干部外出"} for i in all_data]
        elif datavalue == "工会经费":
            all_count = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/LaborUnionExpensesdetail.html?id=" + str(i.id),
                 'text': "修改" if i.get_str_state() == '拒绝' else '审批', "types": "工会经费"} for i in all_data]
        elif datavalue == "材料付款":
            all_count = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/medical_materials_detail_view?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else '修改', "types": "材料付款"} for i in all_data]
        elif datavalue == "付款流程":
            all_count = PaymentApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val) | Q(title__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = PaymentApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val) | Q(title__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/payment_process_detail.html?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else '修改', "types": "付款流程"} for i in all_data]
        elif datavalue == "经济合同会签流程":
            all_count = ContractApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ContractApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/ContractDetail.html?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else '修改', "types": "项目管理"} for i in all_data]
        elif datavalue == "一般付款":
            all_count = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/general_finance_detail_view?id=" + str(i.id),
                 'text': "审批", "types": "一般付款"} for i in all_data]
        elif datavalue == '合同付款':
            all_count = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/logistics_office_apply_detail_view?id=" + str(i.id),
                 'text': "审批" if i.get_str_state() != '拒绝' else '修改', "types": "合同付款"} for i in all_data]
        elif datavalue == "餐补付款":
            all_count = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/nutritional_meals_detail_view?id=" + str(i.id),
                 'text': "修改" if i.get_state_str() == '拒绝' else '审批', "types": "餐补付款"} for i in all_data]
        elif datavalue == "新增医疗服务项目":
            all_count = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/new_medical_services_detail_view?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else '修改', "types": "新增医疗服务项目"} for i in all_data]
        elif datavalue == "手术分级授权":
            all_count = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/surgical_grading_detail_view?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else '修改', "types": "手术分级授权"} for i in all_data]
        elif datavalue == "请假申请":
            all_count = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.get_leave_type(), "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/personal-center/leave_request_detail_view?id=" + str(i.id),
                 'text': "审批", "types": "请假申请"} for i in all_data]
        elif datavalue == "临床医师单独执业资格":
            all_count = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.doctor_ractice_number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/solo_practice_apply_detail_view?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else '修改', "types": "临床医师单独执业资格"} for i in all_data]
        elif datavalue == "经济合同会签":
            all_count = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.contract_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/business_contract_detail_view?id=" + str(i.id),
                 'text': "审批", "types": "历史数据管理"} for i in all_data]
        elif datavalue == "差旅报销":
            all_count = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(
                    applicat__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(
                    applicat__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.business_matter, "create_by": i.applicat.real_name, "department": i.applicat.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/travel_reimbursement.html?id=" + str(
                     i.id) if i.get_state_str() == '拒绝' else "/finance/travel_approval.html?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else "修改", "types": "差旅报销"} for i in all_data]
        elif datavalue == "离职申请":
            all_count = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.dimission_note, "create_by": i.user.real_name, "department": i.user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/dimission_detail_view?id=" + str(i.id),
                 'text': "审批" if i.get_state_str() != '拒绝' else "修改", "types": "离职申请"} for i in all_data]
        elif datavalue == "临床用血费用付款流程":
            all_count = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/pay_with_blood_detail_view?id=" + str(i.id),
                 'text': "审批", "types": "临床用血费用付款"} for i in all_data]
        elif datavalue == "学科经费":
            all_count = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/subject_funding_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "学科经费"} for i in all_data]
        elif datavalue == "科研经费":
            all_count = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/research_funding_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "科研经费"} for i in all_data]
        elif datavalue == "图书/报刊/杂志征订":
            all_count = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": "图书/报刊/杂志征订", "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/BookSubscriptionDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "图书/报刊/杂志征订"} for i in all_data]
        elif datavalue == "党建经费":
            all_count = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason if i.application_reason else json.loads(i.pay_detail)[0][
                    "b"] if json.loads(i.pay_detail) else "党建经费", "create_by": i.apply_user.real_name,
                 "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/PartyBuildingFundsDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "党建经费"} for i in all_data]
        elif datavalue == "项目审计送审申请":
            all_count = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.work_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/object_audit_detail_view?id=" + str(i.id),
                 'text': "审批", "types": "项目审计送审申请"} for i in all_data]
        elif datavalue == "招标结果汇报会签":
            all_count = TenderingSigning.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = TenderingSigning.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.entry_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/tendering_signing_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "招标结果汇报会签"} for i in all_data]
        elif datavalue == "服务采购":
            all_count = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/ServiceProcurementDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "服务采购"} for i in all_data]
        elif datavalue == "货物采购":
            all_count = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": f"{i.GoodsName}({i.GoodsNumber})<br>({i.PurchaseReason})", "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/GoodsProcureDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "货物采购"} for i in all_data]
        elif datavalue == "维修改造":
            all_count = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.EntryName, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/MaintenanceRenovationDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "维修改造"} for i in all_data]
        elif datavalue == "计算机及相关设备购置":
            all_count = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/ComputerDeviceDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "计算机及相关设备购置"} for i in all_data]
        elif datavalue == "短信审批":
            all_count = ShortMessageApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ShortMessageApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/message_approval_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "短信审批"} for i in all_data]
        elif datavalue == "招标采购项目":
            all_count = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/BiddingProcurementProjectDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "招标采购项目"} for i in all_data]
        elif datavalue == "问责申请":
            all_count = InitiateAccountability.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = InitiateAccountability.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": "工作督办问责流程" + "(" + i.work_id.job_source + ")", "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/accountability_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "问责申请"} for i in all_data]
        elif datavalue == "流程节点修改":
            all_count = FlowModify.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = FlowModify.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/process_modification_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "流程节点修改"} for i in all_data]
        elif datavalue == "行政总值班调班申请":
            all_count = ShiftAdjustment.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(shift_change_reason__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time").count()
            all_data = ShiftAdjustment.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(shift_change_reason__contains=search_val),
                current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.shift_change_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/shift_change_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "行政总值班调班申请"} for i in all_data]
        elif datavalue == "会议请假":
            all_count = MeetingRoomLeave.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(reason__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = MeetingRoomLeave.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(reason__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/meetingleavedetail.html?id=" + str(i.id),
                 'text': "审批", "types": "会议请假"} for i in all_data]
        elif datavalue == "数据外导":
            all_count = ConfidentialDataExport.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = ConfidentialDataExport.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/data_export_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "数据外导"} for i in all_data]
        elif datavalue == "公务(外宾)接待事前审批":
            all_count = BeforehandReception.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reception_reason__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = BeforehandReception.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reception_reason__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reception_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/official_business_reception_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "公务(外宾)接待事前审批"} for i in all_data]
        elif datavalue == "公务(外宾)接待清单审批":
            all_count = ReceptionChecklist.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(official_interaction__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = ReceptionChecklist.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(official_interaction__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.official_interaction, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/reception_checklist_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "公务(外宾)接待清单审批"} for i in all_data]
        elif datavalue == "职工出国(境)审批":
            all_count = EmployeesAbroad.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(application_reason__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = EmployeesAbroad.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(application_reason__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/employees_abroad_detail.html?id=" + str(i.id),
                 'text': "审批", "types": "职工出国(境)审批"} for i in all_data]
        elif datavalue == "基建维修改造":
            all_count = InfrastructureMaintenance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = InfrastructureMaintenance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/infrastructure-process/InfrastructureRenovationDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "基建维修改造"} for i in all_data]
        elif datavalue == "基建项目专业服务":
            all_count = ProfessionalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = ProfessionalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/infrastructure-process/ProfessionalServicesDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "基建项目专业服务"} for i in all_data]
        elif datavalue == "体检科支援加班补助":
            all_count = SupportSubsidies.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = SupportSubsidies.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": "体检科支援加班补助", "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/payment-management/OvertimeAllowanceDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "体检科支援加班补助"} for i in all_data]
        elif datavalue == "工会用印申请":
            all_count = OfficialSeal.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = OfficialSeal.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PrintingProcessDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "工会用印申请"} for i in all_data]
        elif datavalue == "工会经济合同会签":
            all_count = EconomicCountersign.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = EconomicCountersign.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.contract_name, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/EconomicSigningDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "工会经济合同会签"} for i in all_data]
        elif datavalue == "工会付款流程":
            all_count = PaymentProcess.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = PaymentProcess.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PayFlowDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "工会付款流程"} for i in all_data]
        elif datavalue == "工会活动审批":
            all_count = EventApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = EventApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PreApprovalDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "工会活动审批"} for i in all_data]
        elif datavalue == "工会物资申购":
            all_count = MaterialsApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = MaterialsApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/GoodsSubscribeDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "工会物资申购"} for i in all_data]
        elif datavalue == "门诊排班调整":
            all_count = OutpatientScheduling.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time").count()
            all_data = OutpatientScheduling.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), current_audit_users=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.stop_reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/SchedulingAdjustmentDetail.html?id=" + str(i.id),
                 'text': "审批", "types": "门诊排班调整"} for i in all_data]
        else:
            all_count = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), current_audit_users=request.user).count()
            all_data = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), current_audit_users=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.customer_form.name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.department,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/CustomProcessDetail.html?id={i.id}',
                 'text': "审批", "types": i.customer_form.module} for i in all_data]

        if flag:
            data_list = manage_flow().audit_post(request.user.id, request.user.real_name)
            return data_list[page1:page2], list(return_data), len(data_list)
        return data_list, list(return_data), all_count

    def search_yiban(self, datavalue, search_val, request, page1, page2):
        print("===================", datavalue, search_val)
        user = request.user
        distributed = []  # 待分发
        return_list = []  # 退回
        circulation = []  # 传阅中
        Later = []  # 待上会
        HasMeet = []  # 已上会
        review_list = []  # 审核中
        end_list = []  # 完结
        return_data = manage_flow().my_done(request.user.id, request.user.real_name)
        if not datavalue:
            datavalue = return_data[0][0]
        if datavalue == "院长办公会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                already_users=request.user,
                type='yb').order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                already_users=request.user,
                type='yb').order_by("-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.topics_name, "create_by": i.employee.real_name,
                            "department": i.company.name,
                            "create_time": i.topicsauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.topicsauditrecord_set.filter(
                                audit_people=request.user) else i.topicsauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id,
                            "node": i.get_state_str(), "reviewer": i.current_audit_user,
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                            "url": f'/personal-center/SubjectDetailst.html?views=1&id={i.id}',
                            'text': "查看", "types": "院长办公会议题"}
                if i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "done":
                    end_list.append(one_dict)
                elif i.state == "unmetting":
                    Later.append(one_dict)
                elif i.state == "metting":
                    HasMeet.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + return_list + Later + HasMeet + end_list
        elif datavalue == "行政例会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                already_users=request.user, type='xz').order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                already_users=request.user, type='xz').order_by("-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.topics_name, "create_by": i.employee.real_name,
                            "department": i.company.name,
                            "create_time": i.topicsauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.topicsauditrecord_set.filter(
                                audit_people=request.user) else i.topicsauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id,
                            "node": i.get_state_str(), "reviewer": i.current_audit_user,
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                            "url": f'/personal-center/SubjectDetailst.html?views=1&id={i.id}',
                            'text': "查看", "types": "行政例会议题"}
                if i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "done":
                    end_list.append(one_dict)
                elif i.state == "unmetting":
                    Later.append(one_dict)
                elif i.state == "metting":
                    HasMeet.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + return_list + Later + HasMeet + end_list
        elif datavalue == "党委会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), ~Q(state__in=['cancel']),
                already_users=request.user, type='db').order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), ~Q(state__in=['cancel']),
                already_users=request.user, type='db').order_by("-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.topics_name, "create_by": i.employee.real_name,
                            "department": i.company.name,
                            "create_time": i.topicsauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.topicsauditrecord_set.filter(
                                audit_people=request.user) else i.topicsauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id,
                            "node": i.get_state_str(), "reviewer": i.current_audit_user,
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                            "url": f'/personal-center/SubjectDetailst.html?views=1&id={i.id}',
                            'text': "查看", "types": "党委会议题"}
                if i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "done":
                    end_list.append(one_dict)
                elif i.state == "unmetting":
                    Later.append(one_dict)
                elif i.state == "metting":
                    HasMeet.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + return_list + Later + HasMeet + end_list
        elif datavalue == "党委会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='a').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='a').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看", "types": "党委会议纪要"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "院长办公会会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='b').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='b').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看",
                            "types": "院长办公会会议纪要"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "党委专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='c').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='c').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看",
                            "types": "党委专题会议纪要"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "院长办公会专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='d').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='d').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看",
                            "types": "院长办公会专题会议纪要"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "行政例会简报":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='e').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='e').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看", "types": "行政例会简报"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "行政公文(京医发)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='f').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='f').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看", "types": "京医发"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "党委公文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='g').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='g').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看", "types": "党委公文"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "京医团总支发文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='i').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user, type='i').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看", "types": "京医团总支发文"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "行政公文(京医文)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel']),
                audit_users_already=request.user, type='h').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel']),
                audit_users_already=request.user, type='h').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.conferencememoauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.conferencememoauditrecord_set.filter(
                                audit_people=request.user) else i.conferencememoauditrecord_set.all().last().update_time.strftime(
                                "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}', 'text': "查看", "types": "京医文"}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "上级来文":
            all_count = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel']),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel']),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            flag = False
            if request.user == User.objects.get(job_number='8166') or request.user == User.objects.get(
                    job_number='9770'):
                flag = True

            data_list = [{"title": i.title, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.officialdocumentsauditrecord_set.filter(
                              audit_people=request.user).last().update_time.strftime(
                              "%Y-%m-%d %H:%M") if i.officialdocumentsauditrecord_set.filter(
                              audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'javascript:;',
                          'text': f"<a href='/personal-center/examinationDetail.html?id={i.id}'>查看</a> | <a href='javascript:;' onclick='model_inlone(\"{i.id}\")'>备注</a>"
                          if flag else f"<a href='/personal-center/examinationDetail.html?id={i.id}'>查看</a>",
                          "types": "上级来文"} for i in all_data]
        elif datavalue == "外部来函":
            all_count = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            flag = False
            if request.user == User.objects.get(job_number='8166') or request.user == User.objects.get(
                    job_number='9770'):
                flag = True

            data_list = [{"title": i.title, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.correspondencerecord_set.filter(
                              audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'javascript:;',
                          'text': f"<a href='/personal-center/ExternalCorrespondenceDetail.html?id={i.id}'>查看</a> | <a href='javascript:;' onclick='model_inlone(\"{i.id}\")'>备注</a>"
                          if flag else f"<a href='/personal-center/ExternalCorrespondenceDetail.html?id={i.id}'>查看</a>",
                          "types": "外部来函"} for i in all_data]
        elif datavalue == "委员会议题":
            all_count = CommitteeTopics.objects.filter(
                Q(topic_name__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = CommitteeTopics.objects.filter(
                Q(topic_name__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[
                       page1:page2]
            for i in all_data:
                one_dict = {"title": i.topic_name, "create_by": i.apply_user.real_name,
                            "department": i.company.name,
                            "create_time": i.committeetopicsrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.committeetopicsrecord_set.filter(
                                audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/supervision-inspection/committee_topics_detail.html?id={i.id}',
                            'text': "查看", "types": "委员会议题"}
                if i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "done":
                    end_list.append(one_dict)
                elif i.state == "unmetting":
                    Later.append(one_dict)
                elif i.state == "metting":
                    HasMeet.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + return_list + Later + HasMeet + end_list
        elif datavalue == "委员会纪要":
            all_count = CommitteeMinutes.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = CommitteeMinutes.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/supervision-inspection/summary_application_detail.html?id={i.id}',
                 'text': "查看", "types": "委员会纪要"} for i in all_data]
        elif datavalue == "通知公告":
            all_count = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.name, "create_by": i.create_people.real_name,
                            "department": i.create_people.company.name,
                            "create_time": i.auditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime(
                                "%Y-%m-%d %H:%M") if i.auditrecord_set.filter(
                                audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "审核中" if i.state in ["one", "two"] else "退回" if i.state == "eight" else "完结", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/announcements/notice_detail.html?id={i.id}',
                            'text': "查看", "types": "通知公告"}
                if i.state == "unaudit":
                    return_list.append(one_dict)
                elif i.state == "draft":
                    review_list.append(one_dict)
                else:
                    end_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "会议室申请":
            all_count = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), ~Q(state__in=["revoke"]),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), ~Q(state__in=["revoke"]),
                audit_users_already=request.user).order_by("-create_time")[
                       page1:page2]
            for i in all_data:
                one_dict = {"title": i.particulars, "create_by": i.names, "department": i.department,
                            "create_time": i.update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "reviewer": i.audit_people.real_name if i.audit_people else '',
                            "node": "退回" if i.state == "draft" else "完结" if i.state == "audit" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{i.audit_people.real_name}</a>' if i.audit_people else '',
                            "url": f'/personal-center/conference_room_detail?id={i.id}',
                            'text': "查看", "types": "会议室申请"}
                if i.state == "draft":
                    return_list.append(one_dict)
                elif i.state == "audit":
                    end_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "车辆申请":
            all_count = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                already_users=request.user).order_by(
                "-create_time").count()
            all_data = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state__in=['cancel', 'stop']),
                already_users=request.user).order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.subject, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name, "reviewer": i.current_audit_user.real_name if i.current_audit_user else "",
                            "create_time": i.vehicleauditrecord_set.filter(
                                audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "退回" if i.state == "refuse" else "完结" if i.state == "cgb" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user.real_name if i.current_audit_user else ""}</a>',
                            "url": f'/personal-center/Vehicle_apply_detail.html?type=already&id={i.id}',
                            'text': "查看", "types": "车辆申请"}
                if i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "cgb":
                    end_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + end_list
        elif datavalue == "大型活动报备":
            all_count = user.gathering_apply_already_audit_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val)).count()
            all_data = user.gathering_apply_already_audit_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val)).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.gathering_place, "create_by": i.apply_user.real_name, "department": i.apply_company.name,
                 "create_time": i.gatheringapplyauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": [['审核中', '完结'][i.state == 'five'], '退回'][i.state == 'three'], "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/administrative/gathering_apply_detail_view?id={i.id}' if i.state != "refuse" else f'/administrative/gathering_apply_detail_view?id={i.id}',
                 'text': "查看", "types": "大型活动报备"} for i in all_data]
        elif datavalue == "医德医风考评":
            all_count = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name,
                 "department": "医德医风评选一组" if i.apply_company_id == "1001" else "医德医风评选二组" if i.apply_company_id == "1002" else "医德医风评选三组" if i.apply_company_id == "1003" else "医德医风评选四组" if i.apply_company_id == "1004" else Company.objects.get(
                     id=i.apply_company_id).name,
                 "create_time": i.evaluationopinion_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "审核中" if i.state in ['one', 'two'] else '已提交' if  i.state == 'three' else "完结", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/medical-ethics/medical_ethics_detail_view?id={i.id}',
                 'text': "查看", "types": "医德医风考评"} for i in all_data]
        elif datavalue == "中层干部外出":
            all_count = OutgoingCadresData.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = OutgoingCadresData.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.outgoingcadresdatarecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "审核中" if i.state in ["one", 'two',
                                              'three'] else "退回" if i.state == 'eight' else '结束' if i.state == 'seven' else '作废' if i.state == 'cancel' else '终止',
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/middle_level_detail.html?id={i.id}', "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 'text': "查看", "types": "中层干部外出"} for i in all_data]
        elif datavalue == "工会经费":
            all_count = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.laborunionexpensesrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/LaborUnionExpensesdetail.html?id=" + str(i.id),
                 'text': "查看", "types": "工会经费"} for i in all_data]
        elif datavalue == "物资领用":
            all_count = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.productadoptauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_display(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_adopt_detail_view?id={i.id}',
                 'text': "查看", "types": "物资领用"} for i in all_data]
        elif datavalue == "物资采购":
            all_count = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.productpurchaseauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_display(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_shenpi_view?id={i.id}',
                 'text': "查看", "types": "物资采购"} for i in all_data]
        elif datavalue == "用印申请":
            all_count = SealApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val) | Q(matter_type_text__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = SealApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val) | Q(matter_type_text__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.matter_type_text, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.sealapplyauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.sealapplyauditrecord_set.filter(
                     audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/seal_apply_detail_view?id={i.id}',
                 'text': "查看", "types": "快捷用印申请" if i.is_fast else "用印申请"} for i in all_data]
        elif datavalue == "印章刻制":
            all_count = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.plan_seal_name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.sealmakingrecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "node": i.get_state_str(),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/seal_making_detail_view?id={i.id}',
                 'text': "查看", "types": "印章刻制"} for i in all_data]
        elif datavalue == "快速用印授权":
            all_count = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[
                       page1:page2]
            data_list = [
                {"title": json.loads(i.reason)[0]['neirong'], "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.quickauthorizationrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/QuickAuthorizationDetail.html?id={i.id}',
                 'text': "查看", "types": "快速用印授权"} for i in all_data]
        elif datavalue == "固定资产/维修维保付款":
            all_count = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.fixedassetsauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.fixedassetsauditrecord_set.filter(
                     audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/fixed_assets_apply_detail_view?id={i.id}',
                 'text': "查看", "types": "固定资产/维修维保付款"} for i in all_data]
        elif datavalue == "差旅申请":
            all_count = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.subject, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.travelapplyauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.travelapplyauditrecord_set.filter(
                     audit_people=request.user) else i.travelapplyauditrecord_set.all().order_by(
                     "-update_time").first().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/travel_apply_detail_view?id={i.id}',
                 'text': "查看", "types": "差旅申请"} for i in all_data]
        elif datavalue == "材料付款审批":
            all_count = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.medicalmaterialsauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/medical_materials_detail_view?id={i.id}',
                 'text': "查看", "types": "材料付款"} for i in all_data]
        elif datavalue == "付款流程":
            all_count = PaymentApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val) | Q(title__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = PaymentApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val) | Q(title__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.paymentapprovalrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/payment_process_detail.html?id={i.id}',
                 'text': "查看", "types": "付款流程"} for i in all_data]
        elif datavalue == "经济合同会签流程":
            all_count = ContractApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = ContractApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.contractapprovalrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/ContractDetail.html?id={i.id}',
                 'text': "查看", "types": "项目管理"} for i in all_data]
        elif datavalue == "一般付款":
            all_count = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.generalfinanceauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/general_finance_detail_view?id={i.id}',
                 'text': "查看", "types": "一般付款"} for i in all_data]
        elif datavalue == "餐补付款":
            all_count = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.nutritionalmealsauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/nutritional_meals_detail_view?id={i.id}',
                 'text': "查看", "types": "餐补付款"} for i in all_data]
        elif datavalue == "新增医疗服务项目":
            all_count = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.newmedicalservicesauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/new_medical_services_detail_view?id={i.id}',
                 'text': "查看", "types": "新增医疗服务项目"} for i in all_data]
        elif datavalue == '合同付款审批':
            all_count = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.logisticsofficeauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/logistics_office_apply_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "合同付款"} for i in all_data]
        elif datavalue == "请假申请":
            all_count = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.get_leave_type(), "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.leaverequestauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/leave_request_detail_view?id={i.id}',
                 'text': "查看", "types": "请假申请"} for i in all_data]
        elif datavalue == "手术分级授权":
            all_count = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.surgicalgradingauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/surgical_grading_detail_view?id={i.id}',
                 'text': "查看", "types": "手术分级授权"} for i in all_data]
        elif datavalue == "临床医师单独执业资格":
            all_count = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.doctor_ractice_number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.solopracticeapplyauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/solo_practice_apply_detail_view?id={i.id}',
                 'text': "查看", "types": "临床医师单独执业资格"} for i in all_data]
        elif datavalue == "经济合同会签":
            all_count = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.contract_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.businesscontractauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/business_contract_detail_view?id={i.id}',
                 'text': "查看", "types": "历史数据管理"} for i in all_data]
        elif datavalue == "差旅报销":
            all_count = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(applicat__department__contains=search_val) | Q(
                    business_matter__contains=search_val) |
                Q(apply_time__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(applicat__department__contains=search_val) | Q(
                    business_matter__contains=search_val) |
                Q(apply_time__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.business_matter, "create_by": i.applicat.real_name, "department": i.applicat.company.name,
                 "create_time": i.travelreimbursementauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "javascript:;",
                 'text': "<a href='/finance/travel_approval.html?id=" + str(
                     i.id) + f"'>查看</a> | <a href='javascript:;' onclick='delete_flow({i.id})' style='clock=red;'>删除</a>",
                 "types": "差旅报销"} for i in all_data]
        elif datavalue == "离职申请":
            all_count = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.dimission_note, "create_by": i.user.real_name, "department": i.user.company.name,
                 "create_time": i.dimissionauditrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.dimissionauditrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/dimission_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "离职申请"} for i in all_data]
        elif datavalue == "临床用血费用付款流程":
            all_count = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.paywithbloodauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/pay_with_blood_detail_view?id={i.id}',
                 'text': "查看", "types": "临床用血费用付款"} for i in all_data]
        elif datavalue == "学科经费":
            all_count = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.subjectfundingrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/subject_funding_detail.html?id={i.id}',
                 'text': "查看", "types": "学科经费"} for i in all_data]
        elif datavalue == "科研经费":
            all_count = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.researchfundingrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/research_funding_detail.html?id={i.id}',
                 'text': "查看", "types": "科研经费"} for i in all_data]
        elif datavalue == "图书/报刊/杂志征订":
            all_count = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": "图书/报刊/杂志征订", "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.booksubscriptionrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.booksubscriptionrecord_set.filter(
                     audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/BookSubscriptionDetail.html?id={i.id}',
                 'text': "查看", "types": "图书/报刊/杂志征订"} for i in all_data]
        elif datavalue == "党建经费":
            all_count = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason if i.application_reason else json.loads(i.pay_detail)[0][
                    "b"] if json.loads(i.pay_detail) else "党建经费", "create_by": i.apply_user.real_name,
                 "department": i.company.name,
                 "create_time": i.partybuildingrecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/PartyBuildingFundsDetail.html?id={i.id}',
                 'text': "查看", "types": "党建经费"} for i in all_data]
        elif datavalue == "项目审计送审申请":
            all_count = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.work_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.objectauditrecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/object_audit_detail_view?id={i.id}',
                 'text': "查看", "types": "项目审计送审申请"} for i in all_data]
        elif datavalue == "招标结果汇报会签":
            all_count = TenderingSigning.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = TenderingSigning.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.entry_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.tenderingsigningrecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/logistics/tendering_signing_detail.html?id={i.id}',
                 'text': "查看", "types": "招标结果汇报会签"} for i in all_data]
        elif datavalue == "服务采购":
            all_count = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.purchasingrequisitionrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/logistics/ServiceProcurementDetail.html?id={i.id}',
                 'text': "查看", "types": "服务采购"} for i in all_data]
        elif datavalue == "货物采购":
            all_count = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": f"{i.GoodsName}({i.GoodsNumber})<br>({i.PurchaseReason})", "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.goodsprocurerecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/logistics/GoodsProcureDetail.html?id={i.id}',
                 'text': "查看", "types": "货物采购"} for i in all_data]
        elif datavalue == "维修改造":
            all_count = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.EntryName, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.maintenancerenovationrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/logistics/MaintenanceRenovationDetail.html?id={i.id}',
                 'text': "查看", "types": "维修改造"} for i in all_data]
        elif datavalue == "计算机及相关设备购置":
            all_count = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.computerdevicerecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/logistics/ComputerDeviceDetail.html?id={i.id}',
                 'text': "查看", "types": "计算机及相关设备购置"} for i in all_data]
        elif datavalue == "招标采购项目":
            all_count = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.biddingprocurementprojectrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/logistics/BiddingProcurementProjectDetail.html?id={i.id}',
                 'text': "查看", "types": "招标采购项目"} for i in all_data]
        elif datavalue == "短信审批":
            all_count = ShortMessageApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = ShortMessageApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.shortmessageapprovalrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/supervision-inspection/message_approval_detail.html?id={i.id}',
                 'text': "查看", "types": "短信审批"} for i in all_data]
        elif datavalue == "问责申请":
            all_count = InitiateAccountability.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__company__name__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = InitiateAccountability.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__company__name__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": "工作督办问责流程" + "(" + i.work_id.job_source + ")", "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name, "id": i.id,
                 "create_time": i.initiateaccountabilityrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if
                 i.initiateaccountabilityrecord_set.filter(audit_people=request.user) else i.create_time.strftime(
                     "%Y-%m-%d %H:%M"),
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/supervision-inspection/accountability_detail.html?id={i.id}',
                 'text': "查看", "types": "问责申请"} for i in all_data]
        elif datavalue == "流程节点修改":
            all_count = FlowModify.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__department__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time").count()
            all_data = FlowModify.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.flowmodifyrecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.flowmodifyrecord_set.filter(
                     audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/supervision-inspection/process_modification_detail.html?id={i.id}',
                 'text': "查看", "types": "流程节点修改"} for i in all_data]
        elif datavalue == "行政总值班调班申请":
            all_count = ShiftAdjustment.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(shift_change_reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = ShiftAdjustment.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(shift_change_reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.shift_change_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.shiftadjustmentrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.shiftadjustmentrecord_set.filter(
                     audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/shift_change_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "行政总值班调班申请"} for i in all_data]
        elif datavalue == "会议请假":
            all_count = MeetingRoomLeave.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = MeetingRoomLeave.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.meetingroomleaverecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.meetingroomleaverecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/meetingleavedetail.html?id=" + str(i.id),
                 'text': "查看", "types": "会议请假"} for i in all_data]
        elif datavalue == "数据外导":
            all_count = ConfidentialDataExport.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = ConfidentialDataExport.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.confidentialdataexportrecord_set.filter(audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.confidentialdataexportrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/data_export_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "数据外导"} for i in all_data]
        elif datavalue == "公务(外宾)接待事前审批":
            all_count = BeforehandReception.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reception_reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = BeforehandReception.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reception_reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reception_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.beforehandreceptionrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.beforehandreceptionrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/official_business_reception_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "公务(外宾)接待事前审批"} for i in all_data]
        elif datavalue == "公务(外宾)接待清单审批":
            all_count = ReceptionChecklist.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(official_interaction__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = ReceptionChecklist.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(official_interaction__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.official_interaction, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.receptionchecklistrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.receptionchecklistrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/reception_checklist_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "公务(外宾)接待清单审批"} for i in all_data]
        elif datavalue == "职工出国(境)审批":
            all_count = EmployeesAbroad.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(application_reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time").count()
            all_data = EmployeesAbroad.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(application_reason__contains=search_val),
                audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.employeesabroadrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.employeesabroadrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/employees_abroad_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "职工出国(境)审批"} for i in all_data]
        elif datavalue == "基建维修改造":
            all_count = InfrastructureMaintenance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = InfrastructureMaintenance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.infrastructuremaintenancerecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.infrastructuremaintenancerecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/infrastructure-process/InfrastructureRenovationDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "基建维修改造"} for i in all_data]
        elif datavalue == "基建项目专业服务":
            all_count = ProfessionalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = ProfessionalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.professionalservicesrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.professionalservicesrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/infrastructure-process/ProfessionalServicesDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "基建项目专业服务"} for i in all_data]
        elif datavalue == "体检科支援加班补助":
            all_count = SupportSubsidies.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = SupportSubsidies.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": "体检科支援加班补助", "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.supportsubsidiesrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.supportsubsidiesrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/payment-management/OvertimeAllowanceDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "体检科支援加班补助"} for i in all_data]
        elif datavalue == "工会用印申请":
            all_count = OfficialSeal.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = OfficialSeal.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.officialsealrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.officialsealrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PrintingProcessDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "工会用印申请"} for i in all_data]
        elif datavalue == "工会经济合同会签":
            all_count = EconomicCountersign.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = EconomicCountersign.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.contract_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.economiccountersignrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.economiccountersignrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/EconomicSigningDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会经济合同会签"} for i in all_data]
        elif datavalue == "工会付款流程":
            all_count = PaymentProcess.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = PaymentProcess.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.paymentprocessrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.paymentprocessrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PayFlowDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会付款流程"} for i in all_data]
        elif datavalue == "工会活动审批":
            all_count = EventApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = EventApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.eventapprovalrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.eventapprovalrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PreApprovalDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会活动审批"} for i in all_data]
        elif datavalue == "工会物资申购":
            all_count = MaterialsApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = MaterialsApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.materialsapprovalrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.materialsapprovalrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/GoodsSubscribeDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会物资申购"} for i in all_data]
        elif datavalue == "门诊排班调整":
            all_count = OutpatientScheduling.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time").count()
            all_data = OutpatientScheduling.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), audit_users_already=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.stop_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.outpatientschedulingrecord_set.filter(audit_people=request.user).last().update_time.strftime("%Y-%m-%d %H:%M") if i.outpatientschedulingrecord_set.filter(audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/SchedulingAdjustmentDetail.html?id=" + str(i.id), 'text': "查看", "types": "门诊排班调整"} for i in all_data]
        else:
            all_count = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), audit_users_already=request.user).count()
            all_data = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), audit_users_already=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.customer_form.name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.department,
                 "create_time": i.lowcodebillauditrecord_set.filter(
                     audit_people=request.user).last().update_time.strftime(
                     "%Y-%m-%d %H:%M") if i.lowcodebillauditrecord_set.filter(
                     audit_people=request.user) else i.create_time.strftime("%Y-%m-%d %H:%M"),
                 "id": i.id, "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/CustomProcessDetail.html?id={i.id}',
                 'text': "查看", "types": i.customer_form.name} for i in all_data]
        # data_list = sorted(data_list, key=lambda dat: dat["create_time"], reverse=True)
        return data_list, list(return_data), all_count

    def search_shenqing(self, datavalue, search_val, request, page1, page2):
        distributed = []  # 待分发
        return_list = []  # 退回
        circulation = []  # 传阅中
        review_list = []  # 审核中
        end_list = []  # 完结
        stop_list = []  # 终止
        cancel_list = []  # 作废
        withdraw_list = []  # 撤回
        Later = []  # 待上会
        HasMeet = []  # 已上会
        user = request.user
        flag = False
        return_data = manage_flow().my_apply(request.user.id, request.user.real_name, request.user.company.name)
        if not datavalue:
            datavalue = return_data[0][0]
            flag = True

        if datavalue == "党委会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='a').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='a').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看",
                            "types": "党委会议纪要", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "院长办公会会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='b').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='b').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看",
                            "types": "院长办公会会议纪要", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "党委专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='c').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='c').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看",
                            "types": "党委专题会议纪要", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "院长办公会专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='d').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='d').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看",
                            "types": "院长办公会专题会议纪要", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "行政例会简报":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='e').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='e').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看",
                            "types": "行政例会简报", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "行政公文(京医发)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='f').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='f').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看", "types": "京医发", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "党委公文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='g').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='g').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看", "types": "党委公文", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "京医团总支发文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='i').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='i').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看",
                            "types": "京医团总支发文", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "行政公文(京医文)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='h').order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user, type='h').order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "完结" if i.state == "seven" else "退回" if i.state == "six" else "待分发" if i.state == "eight" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/personal-center/document_detail.html?id={i.id}' if i.state != "six" else f'refer_back.html?id={i.id}',
                            'text': "修改" if i.state == "six" else "分发" if i.state == "eight" else "查看", "types": "京医文", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()])}
                if i.state == "seven":
                    end_list.append(one_dict)
                elif i.state == "six":
                    return_list.append(one_dict)
                elif i.state == "eight":
                    distributed.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "院长办公会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), employee=request.user,
                type='yb').order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), employee=request.user,
                type='yb').order_by("-create_time")[page1:page2]

            for i in all_data:
                one_dict = {"title": i.topics_name, "create_by": i.employee.real_name,
                            "department": i.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": i.get_state_str(), "reviewer": i.current_audit_user,
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                            "url": f'/personal-center/SubjectDetailst.html?views=1&id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                            'text': "查看" if i.state != "refuse" else "修改", "types": "院长办公会议题"}
                if i.state == "done":
                    end_list.append(one_dict)
                elif i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "unmetting":
                    Later.append(one_dict)
                elif i.state == "metting":
                    HasMeet.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + Later + HasMeet + stop_list + cancel_list + end_list
        elif datavalue == "党委会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), employee=request.user,
                type='db').order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), employee=request.user,
                type='db').order_by("-create_time")[page1:page2]

            for i in all_data:
                one_dict = {"title": i.topics_name, "create_by": i.employee.real_name,
                            "department": i.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": i.get_state_str(), "reviewer": i.current_audit_user,
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                            "url": f'/personal-center/SubjectDetailst.html?views=1&id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                            'text': "查看" if i.state != "refuse" else "修改", "types": "党委会议题"}
                if i.state == "done":
                    end_list.append(one_dict)
                elif i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "unmetting":
                    Later.append(one_dict)
                elif i.state == "metting":
                    HasMeet.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + Later + HasMeet + stop_list + cancel_list + end_list
        elif datavalue == "行政例会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), employee=request.user,
                type='xz').order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), employee=request.user,
                type='xz').order_by("-create_time")[page1:page2]

            for i in all_data:
                one_dict = {"title": i.topics_name, "create_by": i.employee.real_name,
                            "department": i.company.name,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": i.get_state_str(), "reviewer": i.current_audit_user,
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                            "url": f'/personal-center/SubjectDetailst.html?views=1&id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                            'text': "查看" if i.state != "refuse" else "修改", "types": "行政例会议题"}
                if i.state == "done":
                    end_list.append(one_dict)
                elif i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                elif i.state == "unmetting":
                    Later.append(one_dict)
                elif i.state == "metting":
                    HasMeet.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + Later + HasMeet + stop_list + cancel_list + end_list
        elif datavalue == "上级来文":
            all_count = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()

            all_data = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]

            data_list = [{"title": i.title, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "node": "待分发" if i.type == "g" else "退回" if i.type == "f" else "完结" if i.type == "e" else "传阅中" if i.type == "d" else "作废" if i.type == "cancel" else "终止" if i.type == "stop" else "审核中",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/examinationDetail.html?id={i.id}' if i.type in ["a", "b", "c", "d",
                                                                                                    "e", "cancel",
                                                                                                    "stop"] else f'examinationDetail.html?approve=1&id={i.id}',
                          'text': "分发" if i.type == "g" else "修改" if i.type == "f" else "查看", "types": "上级来文"} for i in
                         all_data]
        elif datavalue == "外部来函":
            all_count = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()

            all_data = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]

            data_list = [{"title": i.title, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "待分发" if i.type == "seven" else "退回" if i.type == "six" else "完结" if i.type == "five" else "传阅中" if i.type == "four" else "作废" if i.type == "cancel" else "终止" if i.type == "stop" else "审核中",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'/personal-center/ExternalCorrespondenceDetail.html?id={i.id}' if i.type in ["one",
                                                                                                               "two",
                                                                                                               "three",
                                                                                                               "four",
                                                                                                               "five",
                                                                                                               "cancel",
                                                                                                               "stop"] else f'ExternalCorrespondenceDetail.html?approve=1&id={i.id}',
                          'text': "分发" if i.type == "seven" else "修改" if i.type == "six" else "查看", "types": "外部来函"} for
                         i in all_data]
        elif datavalue == "委员会议题":
            all_count = CommitteeTopics.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = CommitteeTopics.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.topic_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/committee_topics_draft.html?id=" + str(
                     i.id) if i.state == 'draft' else "/supervision-inspection/committee_topics_modify.html?id=" + str(
                     i.id) if i.state == 'refuse' else "/supervision-inspection/committee_topics_detail.html?id=" + str(
                     i.id),
                 'text': "查看", "types": "委员会议题"} for i in all_data]
        elif datavalue == "委员会纪要":
            all_count = CommitteeMinutes.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val),
                apply_user=request.user).order_by("-create_time").count()
            all_data = CommitteeMinutes.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val),
                apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/supervision-inspection/summary_application_detail.html?id={i.id}',
                 'text': "查看", "types": "委员会纪要"} for i in all_data]
        elif datavalue == "会议室申请":
            all_count = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), ~Q(state__in=["revoke"]), names=request.user.real_name).order_by(
                "-create_time").count()
            all_data = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), ~Q(state__in=["revoke"]), names=request.user.real_name).order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.particulars, "create_by": i.names, "department": i.department,
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "退回" if i.state == "draft" else "完结" if i.state == "audit" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{i.audit_people.real_name}</a>' if i.audit_people else '', "reviewer": i.audit_people.real_name if i.audit_people else "",
                            "url": f'/personal-center/conference_room_detail?id={i.id}',
                            'text': "查看", "types": "会议室申请"}
                if i.state == "draft":
                    return_list.append(one_dict)
                elif i.state == "audit":
                    end_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "通知公告":
            all_count = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), create_people=request.user).order_by(
                "-create_time").count()
            all_data = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), create_people=request.user).order_by(
                "-create_time")[page1:page2]
            for i in all_data:
                one_dict = {"title": i.name, "create_by": i.create_people.real_name,
                            "department": i.create_people.company.name, "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "审核中" if i.state in ["one", "two"] else "退回" if i.state == "eight" else "完结",
                            "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                            "url": f'/announcements/notice_change.html?id={i.id}' if i.state == "eight" else f'/announcements/notice_detail.html?id={i.id}',
                            'text': "修改" if i.state == 'eight' else "查看", "types": "通知公告"}
                if i.state == "unaudit":
                    return_list.append(one_dict)
                elif i.state == "draft":
                    review_list.append(one_dict)
                else:
                    end_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "车辆申请":
            all_count = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by("-create_time")[
                       page1:page2]
            for i in all_data:
                one_dict = {"title": i.subject, "create_by": i.apply_user.real_name,
                            "department": i.apply_user.company.name, "reviewer": i.current_audit_user.real_name if i.current_audit_user else "",
                            "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                            "node": "退回" if i.state == "refuse" else "完结" if i.state == "cgb" else "作废" if i.state == "cancel" else "终止" if i.state == "stop" else "审核中",
                            "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user.real_name if i.current_audit_user else ""}</a>',
                            "url": f'/personal-center/Vehicle_apply_detail.html?id={i.id}' if i.state != "refuse" else f'car_recommit.html?id={i.id}',
                            'text': "修改" if i.state == "refuse" else "查看", "types": "车辆申请"}
                if i.state == "refuse":
                    return_list.append(one_dict)
                elif i.state == "cgb":
                    end_list.append(one_dict)
                elif i.state == "cancel":
                    cancel_list.append(one_dict)
                elif i.state == "stop":
                    stop_list.append(one_dict)
                else:
                    review_list.append(one_dict)
            data_list = review_list + distributed + return_list + circulation + stop_list + cancel_list + end_list
        elif datavalue == "大型活动报备":
            all_count = user.gathering_apply_already_audit_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val)).count()
            all_data = user.gathering_apply_already_audit_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val)).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.gathering_place, "create_by": i.apply_user.real_name, "department": i.apply_company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": [['审核中', '完结'][i.state == 'five'], '退回'][i.state == 'three'], "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/administrative/gathering_apply_detail_view?id={i.id}' if i.state != "refuse" else f'/administrative/gathering_apply_detail_view?id={i.id}',
                 'text': "查看", "types": "大型活动报备"} for i in all_data]
        elif datavalue == "医德医风考评":
            all_count = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state="draft"), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), ~Q(state="draft"), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name,
                 "department": "医德医风评选一组" if i.apply_company_id == "1001" else "医德医风评选二组" if i.apply_company_id == "1002" else "医德医风评选三组" if i.apply_company_id == "1003" else "医德医风评选四组" if i.apply_company_id == "1004" else Company.objects.get(
                     id=i.apply_company_id).name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "审核中" if i.state in ['one', 'two'] else '已提交' if  i.state == 'three' else "完结", "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/medical-ethics/medical_ethics_detail_view?id={i.id}',
                 'text': "查看", "types": "医德医风考评"} for i in all_data]
        elif datavalue == "物资领用":
            all_count = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_display(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_adopt_detail_view?id={i.id}',
                 'text': "查看", "types": "物资领用"} for i in all_data]
        elif datavalue == "物资采购":
            all_count = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_display(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_shenpi_view?id={i.id}',
                 'text': "查看", "types": "物资采购"} for i in all_data]
        elif datavalue == "用印申请":
            all_count = SealApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = SealApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.matter_type_text, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/seal_apply_detail_view?id={i.id}',
                 'text': '查看' if i.create_time.strftime("%Y-%m-%d %H:%M") < '2024-06-01 00:00' or i.FileType == '2' else (f"<a href='/personal-center/seal_apply_detail_view?id={i.id}'>查看</a> | <a href='javascript:;' onclick='online_tag(\"yysq\", \"\", \"\", \"\", \"\", \"{i.fj_number}\")'>上传协议</a>" if i.whether_upload == '0' else f"<a href='/personal-center/seal_apply_detail_view?id={i.id}'>查看</a> | <a href='javascript:;' style='color: #CFCFCF;'>上传协议</a>"), "types": "快捷用印申请" if i.is_fast else "用印申请"} for i in all_data]
        elif datavalue == "印章刻制":
            all_count = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.plan_seal_name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/seal_making_detail_view?id={i.id}',
                 'text': "查看", "types": "印章刻制"} for i in all_data]
        elif datavalue == "快速用印授权":
            all_count = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": json.loads(i.reason)[0]['neirong'], "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/QuickAuthorizationDetail.html?id={i.id}',
                 'text': "查看", "types": "快速用印授权"} for i in all_data]
        elif datavalue == "固定资产/维修维保付款":
            all_count = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/personal-center/fixed_assets_apply_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/personal-center/fixed_assets_apply_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "固定资产/维修维保付款"} for i in all_data]
        elif datavalue == "差旅申请":
            all_count = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.subject, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/travel_apply_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/travel_apply_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "差旅申请"} for i in all_data]
        elif datavalue == "中层干部外出":
            all_count = OutgoingCadresData.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = OutgoingCadresData.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/middle_level_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "中层干部外出"} for i in all_data]
        elif datavalue == "工会经费":
            all_count = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/LaborUnionExpensesdetail.html?id=" + str(i.id),
                 'text': "查看", "types": "工会经费"} for i in all_data]
        elif datavalue == "材料付款":
            all_count = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/medical_materials_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/medical_materials_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "材料付款"} for i in all_data]
        elif datavalue == "付款流程":
            all_count = PaymentApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val) | Q(title__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = PaymentApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val) | Q(title__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/payment_process_detail.html?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/payment_process_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "付款流程"} for i in all_data]
        elif datavalue == "经济合同会签流程":
            all_count = ContractApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = ContractApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f"/finance/ContractDetail.html?id={str(i.id)}" if i.state == 'draft' else f"/finance/ContractDetail.html?id={str(i.id)}",
                 "text": f"""<a href='/finance/ContractDetail.html?id={str(i.id)}')>查看</a>""",
                 # 'text': "查看" if i.create_time.strftime(
                 #     "%Y-%m-%d %H:%M") < '2024-06-01 00:00' and i.whether_upload == '0' else f"""<a href='/finance/ContractDetail.html?id={str(i.id)}')>查看</a> | <a href='javascript:;' onclick="online_tag('jjhthq', '{i.topics_id.contract_name}', '{i.apply_user.company.name}', '{"自有经费" if i.topics_id.funding_source == "1" else "学科经费" if i.topics_id.funding_source == "2" else "科研经费" if i.topics_id.funding_source == "3" else "财政拨款" if i.topics_id.funding_source == "4" else "贴息贷款" if i.topics_id.funding_source == "5" else "专项债券" if i.topics_id.funding_source == "6" else "工会经费" if i.topics_id.funding_source == "7" else ""}', '{i.topics_id.application_amount}', '{i.fj_number}')")>上传合同</a>""" if i.state == 'draft' else f"""<a href='/finance/ContractDetail.html?id={str(i.id)}')>查看</a> | <a href='javascript:;' onclick="online_tag('jjhthq', '{i.topics_id.contract_name}', '{i.apply_user.company.name}', '{"自有经费" if i.topics_id.funding_source == "1" else "学科经费" if i.topics_id.funding_source == "2" else "科研经费" if i.topics_id.funding_source == "3" else "财政拨款" if i.topics_id.funding_source == "4" else "贴息贷款" if i.topics_id.funding_source == "5" else "专项债券" if i.topics_id.funding_source == "6" else "工会经费" if i.topics_id.funding_source == "7" else ""}', '{i.topics_id.application_amount}', '{i.fj_number}')")>上传合同</a>""" if i.create_time.strftime(
                 #     "%Y-%m-%d %H:%M") > '2024-06-01 00:00' and i.whether_upload == '0' else f"""<a href='/finance/ContractDetail.html?id={str(i.id)}')>查看</a> | <a href='javascript:;' style="color: #CFCFCF;")>上传合同</a>""" if i.state == 'draft' else f"""<a href='/finance/ContractDetail.html?id={str(i.id)}')>查看</a> | <a href='javascript:;' style="color: #CFCFCF;")>上传合同</a>""",
                 "types": "项目管理"} for i in all_data]
        elif datavalue == "一般付款":
            all_count = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/general_finance_detail_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/general_finance_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "一般付款"} for i in all_data]
        elif datavalue == "餐补付款":
            all_count = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/nutritional_meals_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/nutritional_meals_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "餐补付款"} for i in all_data]
        elif datavalue == "新增医疗服务项目":
            all_count = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/new_medical_services_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/new_medical_services_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "新增医疗服务项目"} for i in all_data]
        elif datavalue == "手术分级授权":
            all_count = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/surgical_grading_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/surgical_grading_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "手术分级授权"} for i in all_data]
        elif datavalue == "合同付款":
            all_count = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/logistics_office_apply_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/logistics_office_apply_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "合同付款"} for i in all_data]
        elif datavalue == "请假申请":
            all_count = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.get_leave_type(), "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/personal-center/leave_request_apply_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/personal-center/leave_request_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "请假申请"} for i in all_data]
        elif datavalue == "临床医师单独执业资格":
            all_count = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.doctor_ractice_number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/solo_practice_apply_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/solo_practice_apply_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "临床医师单独执业资格"} for i in all_data]
        elif datavalue == "经济合同会签":
            all_count = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.contract_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/business_contract_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/business_contract_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "历史数据管理"} for i in all_data]
        elif datavalue == "差旅报销":
            all_count = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(
                    applicat__department__contains=search_val), applicat=request.user).order_by(
                "-create_time").count()
            all_data = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(
                    applicat__department__contains=search_val), applicat=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.business_matter, "create_by": i.applicat.real_name, "department": i.applicat.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/travel_approval.html?id=" + str(i.id),
                 'text': "查看", "types": "差旅报销"} for i in all_data]
        elif datavalue == "离职申请":
            all_count = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), user=request.user).order_by(
                "-create_time").count()
            all_data = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.dimission_note, "create_by": i.user.real_name, "department": i.user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/dimission_apply_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/dimission_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "离职申请"} for i in all_data]
        elif datavalue == "临床用血费用付款流程":
            all_count = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/pay_with_blood_draft_view?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/pay_with_blood_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "临床用血费用付款"} for i in all_data]
        elif datavalue == "学科经费":
            all_count = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/subject_funding_detail.html?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/subject_funding_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "学科经费"} for i in all_data]
        elif datavalue == "科研经费":
            all_count = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/research_funding_detail.html?id=" + str(
                     i.id) if i.state == 'draft' else "/finance/subject_funding_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "科研经费"} for i in all_data]
        elif datavalue == "图书/报刊/杂志征订":
            all_count = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time").count()
            all_data = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": "图书/报刊/杂志征订", "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/BookSubscriptionDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "图书/报刊/杂志征订"} for i in all_data]
        elif datavalue == "党建经费":
            all_count = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason if i.application_reason else json.loads(i.pay_detail)[0][
                    "b"] if json.loads(i.pay_detail) else "党建经费", "create_by": i.apply_user.real_name,
                 "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/PartyBuildingFundsDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "党建经费"} for i in all_data]
        elif datavalue == "项目审计送审申请":
            all_count = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.work_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/object_audit_detail_view?id=" + str(i.id),
                 'text': "查看", "types": "项目审计送审申请"} for i in all_data]
        elif datavalue == "招标结果汇报会签":
            all_count = TenderingSigning.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = TenderingSigning.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.entry_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/tendering_signing_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "招标结果汇报会签"} for i in all_data]
        elif datavalue == "服务采购":
            all_count = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/ServiceProcurementDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "服务采购"} for i in all_data]
        elif datavalue == "货物采购":
            all_count = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.PurchaseReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/GoodsProcureDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "货物采购"} for i in all_data]
        elif datavalue == "维修改造":
            all_count = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.EntryName, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/MaintenanceRenovationDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "维修改造"} for i in all_data]
        elif datavalue == "计算机及相关设备购置":
            all_count = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/ComputerDeviceDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "计算机及相关设备购置"} for i in all_data]
        elif datavalue == "招标采购项目":
            all_count = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/BiddingProcurementProjectDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "招标采购项目"} for i in all_data]
        elif datavalue == "短信审批":
            all_count = ShortMessageApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = ShortMessageApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/message_approval_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "短信审批"} for i in all_data]
        elif datavalue == "问责申请":
            all_count = InitiateAccountability.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = InitiateAccountability.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(apply_user__company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": "工作督办问责流程" + "(" + i.work_id.job_source + ")", "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_str_state(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/accountability_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "问责申请"} for i in all_data]
        elif datavalue == "流程节点修改":
            all_count = FlowModify.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time").count()
            all_data = FlowModify.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/process_modification_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "流程节点修改"} for i in all_data]
        elif datavalue == "行政总值班调班申请":
            all_count = ShiftAdjustment.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(shift_change_reason__contains=search_val),
                apply_user=request.user).order_by("-create_time").count()
            all_data = ShiftAdjustment.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(shift_change_reason__contains=search_val),
                apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.shift_change_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/supervision-inspection/shift_change_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "行政总值班调班申请"} for i in all_data]
        elif datavalue == "会议请假":
            all_count = MeetingRoomLeave.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(reason__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = MeetingRoomLeave.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(reason__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/meetingleavedetail.html?id=" + str(i.id),
                 'text': "查看", "types": "会议请假"} for i in all_data]
        elif datavalue == "数据外导":
            all_count = ConfidentialDataExport.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = ConfidentialDataExport.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/data_export_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "数据外导"} for i in all_data]
        elif datavalue == "公务(外宾)接待事前审批":
            all_count = BeforehandReception.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reception_reason__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = BeforehandReception.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reception_reason__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reception_reason, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/official_business_reception_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "公务(外宾)接待事前审批"} for i in all_data]
        elif datavalue == "公务(外宾)接待清单审批":
            all_count = ReceptionChecklist.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(official_interaction__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = ReceptionChecklist.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(official_interaction__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.official_interaction, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/reception_checklist_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "公务(外宾)接待清单审批"} for i in all_data]
        elif datavalue == "职工出国(境)审批":
            all_count = EmployeesAbroad.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(application_reason__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = EmployeesAbroad.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(application_reason__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/new-flow-logic/employees_abroad_detail.html?id=" + str(i.id),
                 'text': "查看", "types": "职工出国(境)审批"} for i in all_data]
        elif datavalue == "基建维修改造":
            all_count = InfrastructureMaintenance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = InfrastructureMaintenance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/infrastructure-process/InfrastructureRenovationDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "基建维修改造"} for i in all_data]
        elif datavalue == "基建项目专业服务":
            all_count = ProfessionalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = ProfessionalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val) | Q(reason__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/infrastructure-process/ProfessionalServicesDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "基建项目专业服务"} for i in all_data]
        elif datavalue == "体检科支援加班补助":
            all_count = SupportSubsidies.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = SupportSubsidies.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": "体检科支援加班补助", "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/payment-management/OvertimeAllowanceDetail.html?id=" + str(i.id),
                 'text': "查看", "types": "体检科支援加班补助"} for i in all_data]
        elif datavalue == "工会用印申请":
            all_count = OfficialSeal.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = OfficialSeal.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PrintingProcessDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会用印申请"} for i in all_data]
        elif datavalue == "工会经济合同会签":
            all_count = EconomicCountersign.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = EconomicCountersign.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.contract_name, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/EconomicSigningDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会经济合同会签"} for i in all_data]
        elif datavalue == "工会付款流程":
            all_count = PaymentProcess.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = PaymentProcess.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PayFlowDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会付款流程"} for i in all_data]
        elif datavalue == "工会活动审批":
            all_count = EventApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = EventApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/PreApprovalDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会活动审批"} for i in all_data]
        elif datavalue == "工会物资申购":
            all_count = MaterialsApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = MaterialsApproval.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/GoodsSubscribeDetail.html?id=" + str(i.id), 'text': "查看", "types": "工会物资申购"} for i in all_data]
        elif datavalue == "门诊排班调整":
            all_count = OutpatientScheduling.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time").count()
            all_data = OutpatientScheduling.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val), apply_user=request.user).order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.stop_reason, "create_by": i.apply_user.real_name, "department": i.company.name, "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/union-process/SchedulingAdjustmentDetail.html?id=" + str(i.id), 'text': "查看", "types": "门诊排班调整"} for i in all_data]
        else:
            all_count = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), apply_user=request.user).count()
            all_data = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), apply_user=request.user).order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.customer_form.name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.department,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(), "reviewer": ", ".join([t.real_name for t in i.current_audit_users.all()]),
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/CustomProcessDetail.html?id={i.id}',
                 'text': "查看", "types": i.customer_form.name} for i in all_data]
        if flag:
            data_list = manage_flow().apply_post(request.user.id, request.user.real_name)
            return data_list[page1:page2], list(return_data), len(data_list)
        return data_list, list(return_data), all_count

    def search_gezhi(self, datavalue, search_val, request, page1, page2):
        print("=============", datavalue, search_val, page1, page2)
        user = request.user
        return_data = manage_flow().my_shelving(request.user.id, request.user.real_name)
        if not datavalue:
            datavalue = return_data[0][1]
        if datavalue == "院长办公会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), current_audit_user=request.user.real_name,
                type='yb', state="shelve").order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), current_audit_user=request.user.real_name,
                type='yb', state="shelve").order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.topics_name, "create_by": i.employee.real_name, "department": i.employee.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(),
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                 "url": f'/personal-center/SubjectDetailst.html?id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                 'text': f"""<a href="/personal-center/SubjectDetailst.html?id={i.id}">查看</a> | <a href="javaacript:;" onclick="reduction_modes({i.id})">还原</a>""",
                 "types": "院长办公会议题"} for i in all_data]
        elif datavalue == "行政例会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), current_audit_user=request.user.real_name,
                type='xz', state="shelve").order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), current_audit_user=request.user.real_name,
                type='xz', state="shelve").order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.topics_name, "create_by": i.employee.real_name, "department": i.employee.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(),
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                 "url": f'/personal-center/SubjectDetailst.html?id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                 'text': f"""<a href="/personal-center/SubjectDetailst.html?id={i.id}">查看</a> | <a href="javaacript:;" onclick="reduction_modes({i.id})">还原</a>""",
                 "types": "行政例会议题"} for i in all_data]
        elif datavalue == "党委会议题":
            all_count = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), current_audit_user=request.user.real_name,
                type='db', state="shelve").order_by("-create_time").count()
            all_data = Topics.objects.filter(
                Q(topics_name__contains=search_val) | Q(employee__real_name__contains=search_val) | Q(
                    employee__department__contains=search_val), current_audit_user=request.user.real_name,
                type='db', state="shelve").order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.topics_name, "create_by": i.employee.real_name, "department": i.employee.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": i.get_state_str(),
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user}</a>',
                 "url": f'/personal-center/SubjectDetailst.html?id={i.id}' if i.state != "refuse" else f'Issue_modify.html?id={i.id}',
                 'text': f"""<a href="/personal-center/SubjectDetailst.html?id={i.id}">查看</a> | <a href="javaacript:;" onclick="reduction_modes({i.id})">还原</a>""",
                 "types": "党委会议题"} for i in all_data]
        elif datavalue == "党委会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='a',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='a',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "党委会议纪要"} for i in all_data]
        elif datavalue == "院长办公会会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='b',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='b',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "院长办公会会议纪要"} for i in
                         all_data]
        elif datavalue == "党委专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='c',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='c',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "党委专题会议纪要"} for i in
                         all_data]
        elif datavalue == "院长办公会专题会议纪要":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='d',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='d',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "院长办公会专题会议纪要"} for i in
                         all_data]
        elif datavalue == "行政例会简报":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='e',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='e',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "行政例会简报"} for i in all_data]
        elif datavalue == "行政公文(京医发)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='f',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='f',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "京医发"} for i in all_data]
        elif datavalue == "党委公文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='g',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='g',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "党委公文"} for i in all_data]
        elif datavalue == "京医团总支发文":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='i',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='i',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "京医团总支发文"} for i in all_data]
        elif datavalue == "行政公文(京医文)":
            all_count = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='h',
                state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceMemo.objects.filter(
                Q(conference_memo_text__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user, type='h',
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [{"title": i.conference_memo_text, "create_by": i.apply_user.real_name,
                          "department": i.apply_user.company.name,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                          "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                          "url": f'document_detail.html?id={i.id}', 'text': "查看", "types": "京医文"} for i in all_data]
        elif datavalue == "上级来文":
            all_count = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = OfficialDocuments.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/examinationDetail.html?approve=1&id={i.id}', "admin_add": "", 'text': "查看",
                 "types": "上级来文"} for i in all_data]
        elif datavalue == "外部来函":
            all_count = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = Correspondence.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/ExternalCorrespondenceDetail.html?approve=1&id={i.id}', "admin_add": "",
                 'text': "查看", "types": "外部来函"} for i in all_data]
        elif datavalue == "通知公告":
            all_count = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), audit_people=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = Notice.objects.filter(
                Q(name__contains=search_val) | Q(create_people__real_name__contains=search_val) | Q(
                    create_people__department__contains=search_val), audit_people=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.name, "create_by": i.create_people.real_name, "department": i.create_people.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/announcements/notice_approve.html?id={i.id}' if i.state != "unaudit" else f'/announcements/notice_change.html?id={i.id}',
                 "admin_add": "", 'text': "查看", "types": "通知公告"} for i in all_data]
        elif datavalue == "会议室申请":
            all_count = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), audit_people_id=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = ConferenceRoomApplication.objects.filter(
                Q(particulars__contains=search_val) | Q(names__contains=search_val) | Q(
                    department__contains=search_val), audit_people_id=request.user, state="shelve").order_by(
                "-create_time")[
                       page1:page2]
            data_list = [{"title": i.particulars, "create_by": i.names, "department": i.department,
                          "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                          "approved": f'<a href="javascript:;" style="color: red;">{i.audit_people.real_name}</a>',
                          "url": f'/personal-center/conference_room_detail?id={i.id}', "admin_add": "",
                          'text': "查看", "types": "会议室申请"} for i in all_data]
        elif datavalue == "车辆申请":
            all_count = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_user=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = VehicleApply.objects.filter(
                Q(subject__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_user=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.subject, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{i.current_audit_user.real_name}</a>',
                 "url": f'/personal-center/Vehicle_apply_detail.html?id={i.id}' if i.state != "refuse" else f'car_recommit.html?id={i.id}',
                 "admin_add": "", 'text': "查看", "types": "车辆申请"} for i in all_data]
        elif datavalue == "大型活动报备":
            all_count = user.gathering_apply_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val), state="shelve").count()
            all_data = user.gathering_apply_users.filter(
                Q(gathering_place__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_company__name__contains=search_val), state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.gathering_place, "create_by": i.apply_user.real_name, "department": i.apply_company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/administrative/gathering_apply_detail_view?id={i.id}' if i.state != "refuse" else f'/administrative/gathering_apply_detail_view?id={i.id}',
                 "admin_add": "", 'text': "查看", "types": "大型活动报备"} for i in all_data]
        elif datavalue == "医德医风考评":
            all_count = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = EvaluationOfMedicalEthics.objects.filter(
                Q(title__contains=search_val) | Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name,
                 "department": "医德医风评选一组" if i.apply_company_id == "1001" else "医德医风评选二组" if i.apply_company_id == "1002" else "医德医风评选三组" if i.apply_company_id == "1003" else "医德医风评选四组" if i.apply_company_id == "1004" else Company.objects.get(
                     id=i.apply_company_id).name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/medical-ethics/medical_ethics_detail_view?id={i.id}', "admin_add": "", 'text': "查看",
                 "types": "医德医风考评"} for i in all_data]
        elif datavalue == "物资领用":
            all_count = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = ProductAdopt.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_adopt_detail_view?id={i.id}',
                 'text': "查看", "types": "物资领用"} for i in all_data]
        elif datavalue == "物资采购":
            all_count = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = ProductPurchase.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/product_shenpi_view?id={i.id}',
                 'text': "查看", "types": "物资采购"} for i in all_data]
        elif datavalue == "用印申请":
            all_count = SealApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = SealApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.matter_type_text, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/seal_apply_detail_view?id={i.id}',
                 'text': f"""<a href="/personal-center/seal_apply_detail_view?id={i.id}">查看</a> | <a href="javaacript:;" onclick="reduction_func({i.id})">还原</a>""",
                 "types": "快捷用印申请" if i.is_fast else "用印申请"} for i in all_data]
        elif datavalue == "印章刻制":
            all_count = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = SealMaking.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.plan_seal_name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/seal_making_detail_view?id={i.id}',
                 'text': "查看", "types": "印章刻制"} for i in all_data]
        elif datavalue == "快速用印授权":
            all_count = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = QuickAuthorization.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": json.loads(i.reason)[0]['neirong'], "create_by": i.apply_user.real_name,
                 "department": i.apply_user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/finance/QuickAuthorizationDetail.html?id={i.id}', 'text': "查看", "types": "快速用印授权"} for i in
                all_data]
        elif datavalue == "固定资产/维修维保付款":
            all_count = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = FixedAssets.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/personal-center/fixed_assets_apply_detail_view?id=" + str(i.id), 'text': "查看",
                 "types": "固定资产/维修维保付款"} for i in all_data]
        elif datavalue == "差旅申请":
            all_count = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = TravelApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.subject, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/travel_apply_detail_view?id=" + str(i.id), 'text': "查看", "types": "差旅申请"} for i in
                all_data]
        elif datavalue == "中层干部外出":
            all_count = OutgoingCadresData.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = OutgoingCadresData.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/middle_level_detail.html?id=" + str(i.id), 'text': "查看", "types": "中层干部外出"} for i in
                all_data]
        elif datavalue == "工会经费":
            all_count = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = LaborUnionExpenses.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/LaborUnionExpensesdetail.html?id=" + str(i.id), 'text': "查看", "types": "工会经费"} for i
                in all_data]
        elif datavalue == "材料付款":
            all_count = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = MedicalMaterials.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/medical_materials_detail_view?id=" + str(i.id), 'text': "查看", "types": "材料付款"} for i
                in all_data]
        elif datavalue == "一般付款":
            all_count = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = GeneralFinance.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/general_finance_detail_view?id=" + str(i.id), 'text': "查看", "types": "一般付款"} for i in
                all_data]
        elif datavalue == '合同付款':
            all_count = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = LogisticsOffice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/logistics_office_apply_detail_view?id=" + str(i.id), 'text': "查看", "types": "合同付款"}
                for i in all_data]
        elif datavalue == "餐补付款":
            all_count = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = NutritionalMeals.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/nutritional_meals_detail_view?id=" + str(i.id), 'text': "查看", "types": "餐补付款"} for i
                in all_data]
        elif datavalue == "新增医疗服务项目":
            all_count = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = NewMedicalServices.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/new_medical_services_detail_view?id=" + str(i.id), 'text': "查看", "types": "新增医疗服务项目"}
                for i in all_data]
        elif datavalue == "手术分级授权":
            all_count = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = SurgicalGrading.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/surgical_grading_detail_view?id=" + str(i.id), 'text': "查看", "types": "手术分级授权"} for i
                in all_data]
        elif datavalue == "请假申请":
            all_count = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = LeaveRequest.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.get_leave_type(), "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/personal-center/leave_request_detail_view?id=" + str(i.id), 'text': "查看", "types": "请假申请"} for
                i in all_data]
        elif datavalue == "临床医师单独执业资格":
            all_count = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = SoloPracticeApply.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.doctor_ractice_number, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/solo_practice_apply_detail_view?id=" + str(i.id), 'text': "查看", "types": "临床医师单独执业资格"}
                for i in all_data]
        elif datavalue == "经济合同会签":
            all_count = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = BusinessContract.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.contract_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/business_contract_detail_view?id=" + str(i.id), 'text': "查看", "types": "历史数据管理"} for i
                in all_data]
        elif datavalue == "差旅报销":
            all_count = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(
                    applicat__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = TravelReimbursement.objects.filter(
                Q(applicat__real_name__contains=search_val) | Q(
                    applicat__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.business_matter, "create_by": i.applicat.real_name, "department": i.applicat.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/travel_reimbursement.html?id=" + str(
                     i.id) if i.get_state_str() == '拒绝' else "/finance/travel_approval.html?id=" + str(i.id),
                 'text': "查看", "types": "差旅报销"} for i in all_data]
        elif datavalue == "离职申请":
            all_count = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = Dimission.objects.filter(
                Q(user__real_name__contains=search_val) | Q(
                    user__department__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.dimission_note, "create_by": i.user.real_name, "department": i.user.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/dimission_detail_view?id=" + str(i.id), 'text': "查看", "types": "离职申请"} for i in
                all_data]
        elif datavalue == "临床用血费用付款流程":
            all_count = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time").count()
            all_data = PayWithBlood.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    apply_user__department__contains=search_val), current_audit_users=request.user,
                state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.title, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/pay_with_blood_detail_view?id=" + str(i.id), 'text': "查看", "types": "临床用血费用付款"} for i
                in all_data]
        elif datavalue == "学科经费":
            all_count = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = SubjectFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/subject_funding_detail.html?id=" + str(i.id), 'text': "查看", "types": "学科经费"} for i in
                all_data]
        elif datavalue == "科研经费":
            all_count = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = ResearchFunding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.pay_reason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/research_funding_detail.html?id=" + str(i.id), 'text': "查看", "types": "科研经费"} for i in
                all_data]
        elif datavalue == "图书/报刊/杂志征订":
            all_count = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = BookSubscription.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(
                    company__name__contains=search_val), current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": "图书/报刊/杂志征订", "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/BookSubscriptionDetail.html?id=" + str(i.id), 'text': "查看", "types": "图书/报刊/杂志征订"} for
                i in all_data]
        elif datavalue == "党建经费":
            all_count = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = PartyBuilding.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.application_reason if i.application_reason else json.loads(i.pay_detail)[0][
                    "b"] if json.loads(i.pay_detail) else "党建经费", "create_by": i.apply_user.real_name,
                 "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/PartyBuildingFundsDetail.html?id=" + str(i.id), 'text': "查看", "types": "党建经费"} for i
                in all_data]
        elif datavalue == "项目审计送审申请":
            all_count = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = ObjectAudit.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.work_name, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/finance/object_audit_detail_view?id=" + str(i.id), 'text': "查看", "types": "项目审计送审申请"} for i in
                all_data]
        elif datavalue == "服务采购":
            all_count = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = PurchasingRequisition.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/ServiceProcurementDetail.html?id=" + str(i.id), 'text': "查看", "types": "服务采购"} for i
                in all_data]
        elif datavalue == "货物采购":
            all_count = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = GoodsProcure.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.PurchaseReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/GoodsProcureDetail.html?id=" + str(i.id), 'text': "查看", "types": "货物采购"} for i in
                all_data]
        elif datavalue == "维修改造":
            all_count = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = MaintenanceRenovation.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.EntryName, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/MaintenanceRenovationDetail.html?id=" + str(i.id), 'text': "查看", "types": "维修改造"}
                for i in all_data]
        elif datavalue == "计算机及相关设备购置":
            all_count = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = ComputerDevice.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/ComputerDeviceDetail.html?id=" + str(i.id), 'text': "查看", "types": "计算机及相关设备购置"} for
                i in all_data]
        elif datavalue == "招标采购项目":
            all_count = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time").count()
            all_data = BiddingProcurementProject.objects.filter(
                Q(apply_user__real_name__contains=search_val) | Q(company__name__contains=search_val),
                current_audit_users=request.user, state="shelve").order_by(
                "-create_time")[page1:page2]
            data_list = [
                {"title": i.ApplicationReason, "create_by": i.apply_user.real_name, "department": i.company.name,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id, "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": "/logistics/BiddingProcurementProjectDetail.html?id=" + str(i.id), 'text': "查看",
                 "types": "招标采购项目"} for i in all_data]
        else:
            all_count = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), current_audit_users=request.user,
                                                   state="shelve").count()
            all_data = LowCodeBill.objects.filter(Q(apply_user__real_name__contains=search_val) | Q(
                apply_user__company__name__contains=search_val), current_audit_users=request.user,
                                                  state="shelve").order_by("-create_time")[page1:page2]
            data_list = [
                {"title": i.customer_form.name, "create_by": i.apply_user.real_name,
                 "department": i.apply_user.department,
                 "create_time": i.create_time.strftime("%Y-%m-%d %H:%M"), "id": i.id,
                 "node": "搁置",
                 "approved": f'<a href="javascript:;" style="color: red;">{", ".join([t.real_name for t in i.current_audit_users.all()])}</a>',
                 "url": f'/personal-center/CustomProcessDetail.html?id={i.id}',
                 'text': "查看", "types": i.customer_form.name} for i in all_data]
        return data_list, list(return_data), all_count
